<template>
  <div>
    <div class="add"   @click="add">新增</div>
    <page-list
      :url="url"
      :params="filter"
      @initList="_initList"
      ref="pageList"
    >
      <van-cell
        class="card"
        @click="openDetail(item)"
        v-for="(item, index) in list"
        :key="index"
      >
        <div>
          <div>
            <div class="title">
              <div>{{ item.PurposeInterview }}</div>
            </div>
            <van-row gutter="20">
              <van-col>
                <img
                  class="icon"
                  src="@/assets/Images/AppIcon/icon_company_check.png"
                />标题{{ item.Title }}
              </van-col>
            </van-row>
            <van-row gutter="20">
              <van-col>
                <img
                  class="icon"
                  src="@/assets/Images/AppIcon/icon_list_detail.png"
                />状态：{{ item.StatusName }}
              </van-col>
            </van-row>
           
            <van-row gutter="20">
              <van-col>
                <img
                  class="icon"
                  src="@/assets/Images/AppIcon/icon_list_user.png"
                />受理单位: {{ item.CompanyPName }}
              </van-col>
            </van-row>
            <van-row gutter="20">
              <van-col>
                <img
                  class="icon"
                  src="@/assets/Images/AppIcon/icon_list_date.png"
                />录入时间：{{ item.CreateDate | formatDate }}
              </van-col>
            </van-row>
            <van-row>
              <van-col span="24">
                <div class="dep_btm">
                  <div
                    class="btm_item"
                    v-if="item.Status == 10"
                    @click.stop="openEdit(item.ID)"
                  >
                    <img
                      src="@/assets/Images/AppIcon/icon_list_edit.png"
                      alt=""
                    />
                    <div class="mr-10">编辑</div>
                  </div>
                  <div
                    class="btm_item"
                    @click.stop="delData(item)"
                    v-if="item.Status == 10"
                    style="margin-right: 15px"
                  >
                    <img src="@/assets/Images/AppIcon/icon_delete.png" alt="" />
                    <div>删除</div>
                  </div>
                </div>
              </van-col>
            </van-row>
          </div>
        </div>
      </van-cell>
    </page-list>
  </div>
</template>

<script>
import PageList from "../../../components/PageList/PageList.vue";
import { getMenuByMenuCode } from "@/api/common";

export default {
  components: { PageList },
  data() {
    return {
      rightValue: 0,
      url: '/YatFeedback/GetPageData',
      list: [],
      filter: {
        dataType: "List",
      },
    };
  },
  created() {
    this.getMenuByMenuCode();
  },
  methods: {
    _initList(list) {
      this.list = list;
    },
    openDetail(item) {
      this.$router.push({
        path: "/YatFeedback/Detail",
        query: { id: item.ID },
      });
    },
    add() {
      this.$router.push({
        path: "/YatFeedback/Edit",
        query: { id: 0 },
      });
    },
    openEdit(id) {
      this.$router.push({
        path: "/YatFeedback/Edit",
        query: { id: id },
      });
      return true;
    },
    delData(item) {
      this.$dialog
        .confirm({
          title: "询问",
          message: "您确定要删除该反馈记录吗？",
        })
        .then(() => {
          let params = { id: item.ID };
          this.$axios
            .get('/YatFeedback/Delete', {
              params: params,
            })
            .then((res) => {
              this.$toast("删除成功");
              this.$refs.pageList.refreshList();
            });
        })
    },
    getMenuByMenuCode() {
      var me = this;
      getMenuByMenuCode("GxInterviewRecord_List").then((res) => {
        me.rightValue = res.data ? res.data.RoleRightValue : 0;
      });
    },
  },
};
</script>
<style lang="less" scoped>
.dep_btm {
  display: flex;
  justify-content: flex-end;
  line-height: 27px;
  .btm_item {
    display: flex;
    align-items: center;
    img {
      height: 15px;
      width: 15px;
      margin-right: 5px;
    }
  }
}
</style>
